import { Component, OnInit } from '@angular/core';
import { BladeService } from "../../../shared/blade.service";
import { Blade } from "../../../shared/blade/blade.model";
import { BladeData } from "../../../shared/blade/blade-data";
import { Observable } from "rxjs/Observable";
import { UserListComponent } from "./user-list/user-list.component";

@Component({
  selector: 'app-user',
  templateUrl: './user.component.html',
  styleUrls: ['./user.component.css'],
  providers: [BladeService]
})
export class UserComponent implements OnInit {

  /**
   * 当前弹出层
   * 
   * @type {Blade}
   * @memberof UserComponent
   */
  currentBlade: Blade;

  constructor(
    public bladeService: BladeService,
  ) { }

  ngOnInit() {
    this.createUserListBlade()
  }

  /**
   * 创建用户列表弹出层
   * 
   * @memberof UserComponent
   */
  createUserListBlade() {
    let data: BladeData = new BladeData();
    data.id = "UserList";
    data.title = "用户管理";
    // data.subtitle = "风机状态";
    data.isClosingDisabled = true;
    this.currentBlade = this.bladeService.createBlade(UserListComponent, data);
    this.bladeService.showBlade(this.currentBlade);
  }

  /**
   * 是否可以离开
   * 
   * @returns {(boolean | Observable<boolean> | Promise<boolean>)} 
   * @memberof UserComponent
   */
  canDeactivate(): boolean | Observable<boolean> | Promise<boolean> {
    return true;
  }

}



// WEBPACK FOOTER //
// ./src/app/module/basic/user/user.component.ts